package com.xnchat.pro.controller;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class PictureIGet {
    @RequestMapping("/pic")
    public ModelAndView getPicture(){
        HttpRequest get = HttpUtil.createGet("https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1");
        HttpResponse execute = get.execute();
        String body = execute.body();
        return null;
    }
//idx=0 当日图片 1 上一日
/*    public static void main(String[] args) {
        HttpRequest get = HttpUtil.createGet("https://www.bing.com/HPImageArchive.aspx?format=js&idx=1&n=11");
        HttpResponse execute = get.execute();
        String body = execute.body();
        JSONObject jsonObject = JSON.parseObject(body);
        Object url = jsonObject.get("url");
    }*/

    public static void main(String[] args) {
        HttpResponse execute = HttpUtil.createGet("https://animetox.lanzoux.com/irxx4hanblc").execute();
        System.out.println(execute.getCookie());
    }
}
